<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2021/7/27
  Time: 16:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="static/css/animate.min.css" rel="stylesheet">
    <link href="static/css/myAlert.css" rel="stylesheet">
    <link href="static/css/style.min.css?v=4.0.0" rel="stylesheet"><base target="_blank">
</head>
<body>
<div style="width: 60%;margin-left: 20%;margin-top: 10%" class="project">
    <h2 style="text-align: center ;color: #07c227">项目列表</h2>
    <table class="table table-hover" >
        <thead>
        <tr >
            <th>项目名称</th>
            <th>项目编号</th>
            <th>申报单位</th>
            <th>项目类型</th>
            <th>负责人</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody class="first">
        </tbody>
    </table>
</div>
<div class="ibox-content " style="margin-left: 20%;margin-top: 10%">
    <form class="form-horizontal" action="addAchievement" method="post">
        <h2 class="showid">成果认定</h2>
        <input type="hidden" class="newmsg" name="aid">
        <div class="form-group">
            <label class="col-sm-3 control-label">晋升情况：</label>
            <div class="col-sm-8">
                <input type="text" placeholder="晋升情况" class="form-control apromotion" name="apromotion" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">专利：</label>
            <div class="col-sm-8">
                <input type="text" placeholder="专利" class="form-control apatent" name="apatent" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">获奖：</label>
            <div class="col-sm-8">
                <input type="text" placeholder="获奖情况" class="form-control aprize" name="aprize" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">成果转化：</label>
            <div class="col-sm-8">
                <input type="text" placeholder="获奖情况" class="form-control aprize" name="atransform" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">项目升级：</label>
            <div class="col-sm-8">
                <input type="text" placeholder="获奖情况" class="form-control aprize" name="aupdate" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">论著情况：</label>
            <div class="col-sm-8">
                <input type="text" placeholder="获奖情况" class="form-control aprize" name="aworks" readonly>
            </div>
        </div>
        <button type="button" class="btn btn-w-m btn-success yes showal">确认认定</button>
        <button type="button" class="btn btn-w-m btn-default no showal">拒绝认定</button>
    </form>
</div>
<!--引入js-->
<script src="static/js/echarts.min.js"></script>
<script src="static/js/jquery.min.js?v=2.1.4"></script>
<script src="static/js/myAlert.js"></script>
<script src="static/js/jquery.form.min.js"></script>
<script src="static/js/bootstrap.min.js?v=3.3.5"></script>
<script src="static/js/plugins/iCheck/icheck.min.js"></script>
<script>
    $(function (){
        $(".ibox-content").hide();
        $.ajax({
            url:"findProjectBystate",
            type:"post",
            data:{astate:"待认定"},
            dataType:"json",
            success:function (data){
                for (let i = 0; i < data.length; i++) {
                    $(".first").append(" <tr><td id='pid'>"+data[i].pid+"</td><td>"+data[i].pname+"</td><td>"+data[i].pcode+"</td><td>"+data[i].punit+"</td>" +
                        " <td >"+data[i].pdirector+"</td> <td>"+data[i].ptype+"</td>" +
                        "<td><input type='button' class='btn btn-w-m btn-success add' value='成果认定'/>" +
                        "</td> </tr>")
                }
                //成果申请
                $(".add").click(function (){
                    let pid= $(this).parents("tr").find("#pid").text()
                    $(".project").hide();
                    $(".ibox-content").show();
                    $.ajax({
                        url:"findAchieventById",
                        type: "post",
                        data:{pid:pid},
                        success:function (data) {
                            $(".apromotion").val(data.apromotion)
                            $(".apatent").val(data.apatent)
                            $(".aprize").val(data.aprize)
                            $(".atransform").val(data.atransform)
                            $(".aupdate").val(data.aupdate)
                            $(".aworks").val(data.aworks)
                            $(".newmsg").val(data.aid);
                        }
                    })
                })
                //认定
                $(".yes").click(function (){
                    $(".project").show();
                    $(".ibox-content").hide();
                    $.ajax({
                        url:"updateAchievement",
                        type:"post",
                        data:{aid:$(".newmsg").val(),astate:"已认定"},
                    })
                })
                //拒绝
                $(".no").click(function (){
                    $(".project").show();
                    $(".ibox-content").hide();
                    $.ajax({
                        url:"updateAchievement",
                        type:"post",
                        data:{aid:$(".newmsg").val(),astate:"拒绝"},
                    })
                })
                var malert= {
                    title: "Tip",
                    msg: "操作成功",
                }
                $(".showal").click(function (){
                    MyAlert(malert);
                })
            }
        })
    })
</script>
</body>
</html>
